/*******************************************************************************
 * Copyright (c) 2011, 2025 Lablicate GmbH.
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 * 
 * Contributors:
 * Philip Wenig - initial API and implementation
 *******************************************************************************/
package org.eclipse.chemclipse.chromatogram.xxd.classifier.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.List;

import org.eclipse.chemclipse.chromatogram.xxd.classifier.exceptions.NoChromatogramClassifierSupplierAvailableException;
import org.junit.Before;
import org.junit.Test;

public class ChromatogramClassifierSupport_1_Test {

	private ChromatogramClassifierSupport support;
	private ChromatogramClassifierSupplier supplier;

	@Before
	public void setUp() throws Exception {

		support = new ChromatogramClassifierSupport();
		supplier = new ChromatogramClassifierSupplier();
		supplier.setId("net.first.supplier");
		supplier.setDescription("Classifier Description");
		supplier.setClassifierName("Test Classifier Name");
		support.add(supplier);
	}

	@Test
	public void testGetAvailableClassifierIds_1() {

		try {
			List<String> ids = support.getAvailableClassifierIds();
			assertEquals("getId", "net.first.supplier", ids.get(0));
		} catch(NoChromatogramClassifierSupplierAvailableException e) {
			assertTrue("NoChromatogramClassifierSupplierAvailableException", false);
		}
	}

	@Test
	public void testGetIntegratorId_1() {

		try {
			String name = support.getClassifierId(0);
			assertEquals("Name", "net.first.supplier", name);
		} catch(NoChromatogramClassifierSupplierAvailableException e) {
			assertTrue("NoChromatogramClassifierSupplierAvailableException", false);
		}
	}

	@Test
	public void testGetIntegratorSupplier_1() {

		IChromatogramClassifierSupplier supplier;
		try {
			supplier = support.getClassifierSupplier("net.first.supplier");
			assertNotNull(supplier);
			assertEquals("Name", "Test Classifier Name", supplier.getClassifierName());
		} catch(NoChromatogramClassifierSupplierAvailableException e) {
			assertTrue("NoChromatogramClassifierSupplierAvailableException", false);
		}
	}

	@Test
	public void testGetIntegratorNames_1() {

		try {
			String[] names = support.getClassifierNames();
			assertEquals("length", 1, names.length);
			assertEquals("name", "Test Classifier Name", names[0]);
		} catch(NoChromatogramClassifierSupplierAvailableException e) {
			assertTrue("NoChromatogramClassifierSupplierAvailableException", false);
		}
	}
}
